package com.JavaBasic;

import com.test.Person;

//Object对象介绍
public class ObjectDemo {
	public static void main(String[] args) {
		// hashCode()返回对象的地址
		Object object = new Object();
		int x = object.hashCode();
		System.err.println(x);
		
		// getClass()获取对象的运行时类
		// getName()获取对象所属的类名
		Person person = new Person("张三",20);
		Class clazz = person.getClass();
		String clazzName = clazz.getName();
		System.err.println(clazzName);
		
		// equals(Object obj) 比较两个对象是否相等
		Person p1 = new Person("李四",24);
		Person p2 = person;
		boolean result = person.equals(p1);
		boolean result2 = person.equals(p2);
		System.out.println(result);
		System.err.println(result2);
	} 

}
